package com.jiaai.cloud.base.util;

import java.util.Random;

/**
 * Created by Administrator on 2017/8/28.
 */
public class InviteCode {

    // 验证码范围,去掉0(数字)和O(拼音)容易混淆的(小写的1和L也可以去掉,大写不用了)
    private static char[] codeSequence = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
            'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
            'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9'};

    public static String create(){
        StringBuffer randomCode = new StringBuffer();
        for (int i = 0; i < 6; i++) {
            Random random = new Random();
            String strRand = String.valueOf(codeSequence[random.nextInt(codeSequence.length)]);

            randomCode.append(strRand);
        }
        return randomCode.toString();
    }

    public static void main(String[] args) {
        System.out.println(InviteCode.create());
    }
}
